function checkForValidUrl(tabId, changeInfo, tab) {
	if(/^.*acfun\.tv\/v\/ac[\d_]+$/i.test(tab.url)){
		chrome.pageAction.show(tabId);
	}
};

chrome.tabs.onUpdated.addListener(checkForValidUrl);

var urldata = {};
urldata.error = -1;
chrome.runtime.onMessage.addListener(function(request, sender, sendRequest){
	if(request.error!==0){
		return;
	}
	var reqUrl = "http://www.acfun.tv/video/getVideo.aspx?id="+request.vid;
	$.getJSON(reqUrl,{}, function(data){
		urldata.url = data.sourceUrl;
		urldata.error = 0;
	});
});